package com.cheng.io.buffer;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class BufferedWriterTest01 {
    public static void main(String[] args) {
        try (
                BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("io/resources/特性1.txt"))
        ) {
            bufferedWriter.write("你好");
            // bufferedWriter.newLine() 写入一个换行符或者直接使用bufferedWriter.write("\n")换行
            bufferedWriter.newLine();
            bufferedWriter.write("世界!");

            bufferedWriter.flush();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
